<div style="display:none;" class="bgm">
    <img data-src="../data/jnh.mp3" alt="bgm">
  </div>
<!--播放按钮  -->
<a class="btn_music active" title="点击播放"></a>
<!-- <script src="../js/music.js"></script> -->
<audio id="Jmusic" class="media-audio" src="../data/jnh.mp3" audio autoplay preload="" loop="loop"></audio>
<script type="text/javascript">
    function audioAutoPlay(id) { //全局控制播放函数
        var audio = document.getElementById(id),
            play = function() {
                audio.play();
                document.removeEventListener("touchstart", play, false);
            };
        audio.play();
        document.addEventListener("touchstart", play, false);
    }
    var audios = document.getElementById('Jmusic');
    $(".btn_music").click(function() {
        if($(".btn_music").hasClass("active")) {
            audios.pause();
            $(".btn_music").removeClass("active");
        } else {
            audioAutoPlay('Jmusic');
            $(".btn_music").addClass("active");
        }
    });
    window.onload = function(){
        // $(".btn_music").click();
         Jmusic.muted = false;
    };
</script>